package cn.founder.basic.inInterceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器管理
 */
//申明拦截器管理
@Configuration
public class WebConfigurer implements WebMvcConfigurer{

    //注入需要管理的拦截器
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")//拦截所有请求
                .excludePathPatterns("/login/**")//放行登录
                .excludePathPatterns("/shop/settlement")//放行商店入驻
                .excludePathPatterns("/user/phone/register")//放行用户注册
                .excludePathPatterns("/fastDfs/**")//放行文件上传
                .excludePathPatterns("/verifycode/**");//放行注册码获取
    }
}
